<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>品牌重复</title>
    <link rel="stylesheet" type="text/css" href="/webapp/css/easyui.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/icon.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/color.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/public.css">
    <script type="text/javascript" src="/webapp/js/lib/jquery.min.js"></script>
    <script type="text/javascript" src="/webapp/js/lib/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/webapp/js/lib/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/webapp/js/common/config.js"></script>
</head>
<body>
     <div class="easyui-container-fluid">
         <div class="easyui-panel" style="border:none;">
             <div class="nav" id="nav"></div>
             <div class="easyui-panel" style="border:none;">
                 <form id="ff">
                     <div style="margin-bottom:20px;">
                     	<span>
                         <label class="item-label">年份：</label>
                         <input type="text" class="easyui-combobox" name="year" id="year" style="width:100px;"/>
                     	</span>
                     	<span id="monthLabel">
	                         <label class="item-label">月份：</label>
	                         <input type="text" class="easyui-combobox" name="month" id="month" style="width:100px;"/></span>
                     	<span id="weekLabel">
	                         <label class="item-label">周数：</label>
	                         <input type="text" class="easyui-combobox" name="week" id="week" style="width:100px;"/></span>
                     	<label class="item-label">品类：</label>
		                <select id="categorySelect" name="categoryCode" class="easyui-combobox" style="width:100px;"></select> 
		                <!-- 
                        <label class="item-label">渠道：</label>
                        <select id="channelSelect" name="channelCode" class="easyui-combobox" style="width:100px;"></select>
		                 -->
                        <a href="javascript:void(0);" style="margin-left:40px;width:80px;" class="easyui-linkbutton c8" onclick="searchBy()">查询</a>
                     </div>
                     <div style="margin-bottom:20px;">
                     	<div style="float: left;">
	                     	<label class="item-label" style="margin-top: 3px;">备注：</label>
                     	</div>
                     	<div style="float: left;margin-left: 10px;margin-bottom: 10px;">
	                     	<div>分商场分品牌统计销量>=
	                     		<input type="text" name="minSalesCount" class="easyui-textbox" style="width:100px;" required="required"/>
	                     	</div>
	                     	<div>筛选出每个品牌的型号销量合计与上月合计相比，所有型号销量一致的显示出来</div>
                     	</div>
                     </div>
                 </form>
             </div>
             <div class="table-wrapper">
                 <table id="datagrid" class="easyui-datagrid" data-options="fitColumns:true,scrollbarSize:0">
                     <thead>
                        <tr>
                            <th data-options="field:'channelName',align:'center',formatter:'formatChannel'" width="120">渠道</th>
                            <th data-options="field:'mallName',align:'center',formatter:'formatMall'" width="120">商场</th>
                            <th data-options="field:'brandName',align:'center',formatter:'formatBrand'" width="120">品牌</th>
                            <th data-options="field:'currentSalesCount',align:'center'" width="100">本月（周）</th>
                            <th data-options="field:'lastSalesCount',align:'center'" width="100">上月（周）</th>
                            <th data-options="field:'lastPeriodCount',align:'center'" width="100">操作</th>
                        </tr>
                     </thead>
                 </table>
             </div>
         </div>
     </div>
     <script type="text/javascript">
         $(function(){
             setNav();
             //initChannelSelect("channelSelect");
             initUserCategorySelect("categorySelect");
             initMonthWeek("monthLabel","weekLabel");
             $("#datagrid").datagrid({
                 // pagination:true,
                 rownumbers:true
             });
             aRecords("品牌重复","/webapp/pages/product/audit/brandrepeat")
         });
         
         function searchBy(){
             alert('功能暂不开放');
             return;
        	 if(!$('#categorySelect').combobox('getValue')){
        		 alert('请选择品类');
        		 return;
        	 }
        	 var minSalesCount = $("input[name='minSalesCount']").val();
        	 minSalesCount = ~~minSalesCount;
        	 if(minSalesCount<=0){
        		 alert('请输入有效的销量值');
        		 return;
        	 }
             var data = getFormData(document.getElementById("ff"));
             data.reportType=window.parent.workMode.toUpperCase();
             $.ajax({
                  url:config.url + "/brandRepeat/data",
                  type:"get",
                  data:transfer(data),
                  xhrFields:{withCredentials:true},
                  beforeSend:function () {
                      $.messager.progress({
                          title:"请稍等",
                          interval:50,
                          text:"数据加载中..."
                      });
                    },
                  success:function(data){
                	  if(data.categoryReportList && data.categoryReportList.length>0){
	                	  $("#datagrid").datagrid({data: data.categoryReportList}).datagrid("getPager");
                	  }else{
	                	  $("#datagrid").datagrid({data: []}).datagrid("getPager");
                	  }
                	  $.messager.progress("close");
                  },
                  error:function(data){
                     console.log(data);
                     $.messager.progress("close");
                  }
              });
          }
         
		function formatChannel(val, row) {
			return row.channelName + '(' + row.channelCode + ')';
		}
		function formatMall(val, row) {
			return row.mallName + '(' + row.mallCode + ')';
		}
		function formatBrand(val, row) {
			return row.brandName + '(' + row.brandCode + ')';
		}
		
	</script>
</body>
</html>